gusucode.com > 《MATLAB图像与视频处理实用案例详解》代码 > 《MATLAB图像与视频处理实用案例详解》代码/第 07 章 基于主成分分析的人脸二维码识别/FaceRec.m
function Ims = FaceRec(c, sz) if ischar(c) d = []; ind = strfind(c, ' '); for i = 1 : length(ind)-1 di = c(ind(i):ind(i+1)); d = [d str2double(di)]; end c = [d str2double(c(ind(i+1):end))]; end load(fullfile(pwd, '人脸库/model.mat')); temp = base(:,1:length(c))* c'; temp = temp + samplemean'; Ims = im2uint8(mat2gray(reshape(real(temp), sz(1), sz(2))));